      
<link href="{{$LAYOUT_HELPER_URL}}admin/js/jquery-ui/css/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="{{$LAYOUT_HELPER_URL}}admin/js/jquery-ui/js/jquery-ui.js"></script>
<script src="{{$LAYOUT_HELPER_URL}}admin/js/jquery.slug.js"></script>
<!--fancybox-->

    <script type="text/javascript" src="{{$LAYOUT_HELPER_URL}}admin/js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
    <link rel="stylesheet" type="text/css" href="{{$LAYOUT_HELPER_URL}}admin/js/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<!--    <link href="{{$LAYOUT_HELPER_URL}}admin/js/fancybox/fancybox.css" rel="stylesheet" type="text/css" />-->

    
<script type="text/javascript">



</script> 
    
            <h2>Manage Lecture</h2>
            
             <!-- End .shortcut-buttons-set -->
            
            <div class="clear"></div> <!-- End .clear -->
           
            
            
            <div class="content-box"><!-- Start Content Box -->
                
                <div class="content-box-header">
                    
                    <div style="float:left;">
                        <a name="listoflecture"><h3></h3></a>
                   </div>     
                   <div style="float:right;padding-right:20px;padding-top:5px;">
                        <form class="search" name="search" method="post" action="{{$APP_BASE_URL}}book/admin/manage-lecture">
                            Title <input class="text-input small-input" type="text" name="condition[keyword]" id="keyword" value="{{$condition.keyword}}"/>
                            
                            <select name="condition[subject_id]">
                                <option value="">All categories</option>
                            {{foreach from=$allCats item=item}}
                                <option value="{{$item.product_category_gid}}" {{if $condition.subject_id== $item.product_category_gid}}selected="selected"{{/if}}>{{$item.name}}</option>
                            {{/foreach}}
                            </select> 
                            <input class="button" type="submit" value="Search" />
                        </form>
                        
                   </div>
                    
                </div> <!-- End .content-box-header -->
                
                <div class="content-box-content">
                    
                    <div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->
                        
                       
                       
                        <!-- MESSAGE HERE -->
                        {{if $allLecture|@count <= 0}}
                        <div class="notification information png_bg">
                            <a href="#" class="close"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                No content with above conditions.
                            </div>
                        </div>
                        {{/if}}
                        
                        {{if $lectureMessage|@count > 0 && $lectureMessage.success == true}}
                        <div class="notification success png_bg">
                            <a href="#" class="close"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                {{$lectureMessage.message}}
                            </div>
                        </div>
                        {{/if}}
                        
                        {{if $lectureMessage|@count > 0 && $lectureMessage.success == false}}
                        <div class="notification error png_bg">
                            <a href="#" class="close"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                {{$lectureMessage.message}}
                            </div>
                        </div>
                        {{/if}}
                        
                        <!-- END MESSAGE -->
                        
                        
                        
                                              <form method="POST" name="sortForm">
                        {{if $allLecture|@count > 0}}
                        
                        <table>
                            <thead>
                                <tr>
                                   <th width="3%"><input class="check-all" type="checkbox" /></th>
                                  <th width="18%">Title</th>
                                   <th width="18%">Category</th>
                                  <th class="center" width="8%">Created Date</th>
                                  <th class="center" width="8%">Updated Date</th> 
                                                                     
                                   <th width="6%">Action</th>
                                </tr>
                                
                            </thead>
                         
                         
                            <tbody>
                            
                            {{foreach from=$allLecture item=item name=book}}
                                <tr>
                                    <table>
                                        <tr>
                                            <td width="3%"><input type="checkbox" value="{{$item.lecture_id}}" name="allBook"/></td>
                                            
 <td width="18%">{{$item.title}}</td>
		                                    
    <td width="18%">{{$item.cname}}</td>                                        
                                            <th class="center" width="8%">{{$item.created_date}}</th>
                                             <th class="center" width="8%">{{$item.update_date}}</th>      
                                                                                        
<!--                                            <td width="15%">{{$item.created_date}}</td>-->
                                           
                                            <td width="6%">
                                                 {{if $fullPermisison}}
                                                 <a href="{{$APP_BASE_URL}}book/admin/edit-lecture/id/{{$item.lecture_id}}" title="Edit"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/pencil.png"  alt="Edit Lecture" /></a>
                                                 <a href="javascript:deleteALecture({{$item.lecture_id}})" title="Delete"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross.png"  alt="Delete" /></a>
                                                 {{else}}
                                                 --
                                                 {{/if}}
                                            </td>
                                           </tr>
                                           
                                         
                                           <tr>
                                           </tr>
                                           
                                           
                                         
                                           <tr></tr>
                                    
                                    
                                    </table>
                                    <!-- END 1 COL -->
                                </tr>
                            {{/foreach}}                     
                            
                            </tbody>
                        </table>
                       
                        </form>
                        
                        <br/>
                        <!-- CHOOSE ACTION -->
                        {{p name=edit_lecture module=book}}
                        <div class="bulk-actions align-left" style="float: left;padding-top: 14px;">
                            <select id="action">
                                <option value=";">Choose an action...</option>
                                {{p name=delete_lecture module=book}}
                                <option value="deleteLecture();">Delete</option>
                                {{/p}}
                               
                            </select>
                            <a class="button" href="javascript:applySelected();">Apply to selected</a>
                        </div>
                        {{/p}}
                        
                        <div class="bulk-actions align-left" style="float: left;padding-top: 10px; padding-left:30px;">
                            <form class="search" name="search" method="post" action="{{$APP_BASE_URL}}book/admin/manage-lecture">
                                Display #
                                <select name="displayNum" onchange="this.parentNode.submit();" style="clear: both;">
                                    <option value="5" {{if $displayNum == 5}} selected="selected" {{/if}}>5</option>
                                    <option value="10" {{if $displayNum == 10}} selected="selected" {{/if}}>10</option>
                                    <option value="20" {{if $displayNum == 20}} selected="selected" {{/if}}>20</option>
                                    <option value="50" {{if $displayNum == 50}} selected="selected" {{/if}}>50</option>
                                    <option value="100" {{if $displayNum == 100}} selected="selected" {{/if}}>100</option>
                                    <option value="1000000000" {{if $displayNum >= 1000000000}} selected="selected" {{/if}}>All</option>
                                </select>
                            </form>
                        </div>
                        
                        <!-- PAGINATION -->
                        {{if $countAllPages > 1}}
                        <div class="pagination" style="float: right;">
                            {{if $first}}
                            <a href="?page=1" class="number" title="First Page">&laquo; First</a>
                            {{/if}}
                            {{if $prevPage}}
                            <a href="?page={{$prevPage}}" class="number" title="Previous Page">&laquo;</a>
                            {{/if}}
                            
                            {{foreach from=$prevPages item=item}}
                            <a href="?page={{$item}}" class="number" title="{{$item}}">{{$item}}</a>
                            {{/foreach}}
                            
                            <a href="#" class="number current" title="{{$currentPage}}">{{$currentPage}}</a>
                            
                            {{foreach from=$nextPages item=item}}
                            <a href="?page={{$item}}" class="number" title="{{$item}}">{{$item}}</a>
                            {{/foreach}}
                            
                            {{if $nextPage}}
                            <a href="?page={{$nextPage}}" class="number" title="Next Page">&raquo;</a>
                            {{/if}}
                            {{if $last}}
                            <a href="?page={{$countAllPages}}" class="number" title="Last Page">Last &raquo;</a>
                            {{/if}}
                        </div> <!-- End .pagination -->
                        {{/if}}
                    {{/if}}    
                        
                        <div class="clear"></div>
                    </div> <!-- End #tab1 -->
                    
                    
                </div> <!-- End .content-box-content -->
                
            </div> <!-- End .content-box -->
            
            
            <div class="clear"></div>
            
<script language="javascript" type="text/javascript">
$(document).ready(function(){
    document.getElementById('keyword').select();
    document.getElementById('keyword').focus();
});

function applySelected()
{
	var task = document.getElementById('action').value;
	eval(task);
}



function deleteLecture()
{
    var all = document.getElementsByName('allLecture');
    var tmp = '';
    var count = 0;
    for (var i = 0; i < all.length; i++) {
        if (all[i].checked) {
             tmp = tmp + '_' + all[i].value;
             count++;
        }
    }
    if ('' == tmp) {
        alert('Please choose a lecture');
        return;
    } else {
    	result = confirm('Are you sure you want to delete ' + count + ' lecture(s)?');
        if (false == result) {
            return;
        }
    }
    window.location.href = '{{$APP_BASE_URL}}book/admin/delete-lecture/id/' + tmp;
}


function deleteALecture(id)
{
    result = confirm('Are you sure you want to delete this lecture?');
    if (false == result) {
        return;
    }
    window.location.href = '{{$APP_BASE_URL}}book/admin/delete-lecture/id/' + id;
}
</script>
